import { RouteRecordRaw } from "vue-router";
import HomeView from "@/views/domUser/HomeView.vue";
import AdminView from "@/views/AdminView.vue";
import NoAuthView from "@/views/NoAuthView.vue";
import ACCESS_ENUM from "@/access/accessEnum";
import UserLoginView from "@/views/user/UserLoginView.vue";
import UserRegisterView from "@/views/user/UserRegisterView.vue";
import UserLayout from "@/layouts/UserLayout.vue";
import AboutView from "@/views/domUser/AboutView.vue";
import RoomView from "@/views/domUser/RoomView.vue";
import ApplyView from "@/views/domUser/ApplyView.vue";
import CallboardView from "@/views/domUser/CallboardView.vue";
import LookApply from "@/views/domUser/LookApply.vue";

export const routes: Array<RouteRecordRaw> = [
  {
    path: "/user",
    name: "用户",
    component: UserLayout,
    meta: {
      hideInMenu: true,
    },
    children: [
      {
        path: "/user/login",
        name: "用户登录",
        component: UserLoginView,
      },
      {
        path: "/user/register",
        name: "用户注册",
        component: UserRegisterView,
      },
    ],
  },
  {
    path: "/callboard",
    name: "公告",
    component: CallboardView,
    meta: {
      access: ACCESS_ENUM.USSR,
    },
  },
  {
    path: "/Apply",
    name: "调宿申请",
    component: ApplyView,
    meta: {
      access: ACCESS_ENUM.USSR,
    },
  },
  {
    path: "/",
    name: "用户信息",
    component: HomeView,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/lookApply",
    name: "审批",
    component: LookApply,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/room",
    name: "房间信息",
    component: RoomView,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/about",
    name: "个人信息",
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: AboutView,
    meta: {
      access: ACCESS_ENUM.USSR,
    },
  },
  {
    path: "/admin",
    name: "发布通告",
    component: AdminView,
    meta: {
      access: ACCESS_ENUM.ADMIN,
    },
  },
  {
    path: "/noAuth",
    name: "没权限",
    component: NoAuthView,
    meta: {
      hideInMenu: true,
    },
  },
];
